package com.questionGenerator.commom.utils;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: usagi
 * @Date: 2024/06/29/13:29
 * @Description:
 */
public class fileSizeConvertUtil {
    public static String convertFileSize(long fileSize) {
        if(fileSize < 1024) {
            return fileSize + " bytes";
        } else if(fileSize < 1024 * 1024) {
            return fileSize / 1024 + " KB";
        } else if(fileSize < 1024 * 1024 * 1024) {
            return fileSize / (1024 * 1024) + " MB";
        } else {
            return fileSize / (1024 * 1024 * 1024) + " GB";
        }
    }
}
